<template>
  <div class="common-layout">
    <el-container>
      <el-aside class="transition-all duration-500" :width="menuStore.menuWidth">
        <AdminMenu/>
      </el-aside>
      <el-container>
        <el-header>
          <AdminHeader/>
        </el-header>
        <el-main>
          <AdminTagList/>
          <!-- 主内容（根据路由动态展示不同页面） -->
          <router-view v-slot="{ Component }">
            <Transition name="fade">
              <!-- max 指定最多缓存 10 个组件 -->
              <KeepAlive :max="10">
                <component :is="Component"></component>
              </KeepAlive>
            </Transition>
          </router-view>
        </el-main>
        <el-footer>
          <AdminFooter/>
        </el-footer>
      </el-container>
    </el-container>
  </div>
</template>
<script setup>
import AdminMenu from "@/layouts/admin/components/AdminMenu.vue";
import AdminHeader from "@/layouts/admin/components/AdminHeader.vue";
import AdminTagList from "@/layouts/admin/components/AdminTagList.vue";
import AdminFooter from "@/layouts/admin/components/AdminFooter.vue";
import {useMenuStore} from '@/stores/menu'
import {onMounted} from "vue";
onMounted(() => {
  // 移除 html 标签中的 class="dark"
  document.documentElement.classList.remove('dark');
})
const menuStore = useMenuStore()
</script>

<style scoped>
.el-header, .el-footer {
  padding: 0 !important;
}

.border-b {
  border-bottom-width: 0;
}

/* 内容区域过渡动画：淡入淡出效果 */
/* 刚开始进入时 */
.fade-enter-from {
  /* 透明度 */
  opacity: 0;
}

/* 刚开始结束 */
.fade-enter-to {
  opacity: 1;
}

/* 刚开始离开 */
.fade-leave-from {
  opacity: 1;
}

/* 离开已结束 */
.fade-leave-to {
  opacity: 0;
}

/* 离开进行中 */
.fade-leave-active {
  transition: all 0.3s;
}

/* 进入进行中 */
.fade-enter-active {
  transition: all 0.3s;
  transition-delay: 0.3s;
}

</style>